Tree


Basic concept

(The above image is from http://alrightchiu.github.io/SecondRound/.)

Tree Definition:

Only one root.

No cycle exists.

Degree: For a given node, its number of children.

External Node / leaf Node: Any node that does not have child nodes.

Internal Node : Any node of a tree that has at least one child node.

Height of node: The biggest number of edges from one node to a leaf node.

(The above image is from http://alrightchiu.github.io/SecondRound/.)